%h3.head Post Images
.well
  = form_for([@post, @post.images.build], :html => { :multipart => true }) do |f|
    .custom-upload
      %input{:name => "image[image]", :type => "file"}
      .fake-file
        %input{:disabled => "disabled"}
    = f.submit :class => "btn btn-small", :value => "Upload Image"
  - unless @post.images.empty?
    .images
      - @post.images.each do |image|
        - if image.id
          - unless image.thumb.nil?
            .image-thumb
              = image_tag image.thumb.url
              %p.centered
                %a{ :href => "#add", :class => "add-photo", "data-image" => image.image.url } Add To Post
                - if can? :delete, image
                  = link_to post_image_path(@post, image), :confirm => 'Are you sure?', :method => :delete, :remote => true, :class => "delete-image close" do
                    &times;
%h3.head Post Editor
.well
  = form_for @post do |f|
    - if @post.errors.any?
      #error_explanation.well
        %h4
          = pluralize(@post.errors.count, "error")
          prohibited this post from being saved:
        %ul
          - @post.errors.full_messages.each do |msg|
            %li= msg
    .row-fluid
      .span6
        .field
          = f.label :title, "Post Title"
          = f.text_field :title, :placeholder => "Title is required."
      .span6
        .field
          = f.label :written_at, "Timestamp"
          = f.text_field :written_at, :class => "datepicker"
    .field
      = f.label :slug, "Post Slug"
      = f.text_field :slug, :placeholder => "Auto-filled"
    .field
      = f.label :excerpt, "Excerpt"
      = f.text_area :excerpt, :placeholder => "This is where the summary of your post goes. Markdown can be used in this non-required field.", :rows => 2
    .field
      = f.label :body, "Main Content"
      = f.text_area :body, :placeholder => "This is where your post goes. Markdown can be used in this field."
    .field
      = f.label :tag_list, "Tags"
      = f.text_field :tag_list, :placeholder => "Comma-separated tags."
    %label.checkbox
      = f.check_box :published
      = f.label :published, "Publish"
    .actions
      = f.submit :class => "btn btn-primary"